export default {
  state: {
    testStr: "测试字符串",
    testNum: 0,
    testBool: true,
    testArr: Array.from({ length: 5 }).map((it, id) => {
      return {
        label: `数组${id}`,
        value: `${(id + 1) * 5}`,
      };
    }),
    testObj: {
      name: "测试对象",
      value: "测试值",
    },
  },
  mutations: {
    setStr: (state: any, payload: string) => {
      state.testStr = payload;
    },
    toggleBool: (state: any) => {
      state.testBool = !state.testBool;
    },
    setNum: (state: any, payload: number) => {
      state.testNum = payload;
    },
    setArr: (state: any, payload: any[]) => {
      state.testArr = payload;
    },
    setObj: (state: any, payload: Record<string, any>) => {
      state.testObj = payload;
    },
  },
};
